package com.doit.scala;

import org.apache.kafka.clients.producer.Partitioner;
import org.apache.kafka.common.Cluster;

import java.util.Map;

public class MyPartitioner implements Partitioner {
    @Override
    public int partition(String topic, Object key, byte[] keyBytes, Object value, byte[] valueBytes, Cluster cluster) {
       /* String s = value.toString();
        if (s.startsWith("a")){
            return 0;
        }else if(s.startsWith("b")){
            return 1;
        }else {
            return 2;
        }*/
        return 0;

    }

    @Override
    public void close() {

    }

    @Override
    public void configure(Map<String, ?> configs) {

    }
}
